home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / rs0422.zip / LEVEL1 / DR200.AS < prev    next >
Text File  |  1990-11-14  |  10KB  |  369 lines

  1. ;/*
  2. ; * Copyright 1988 by the Radio Amateur Telecommunications Society
  3. ; * and Thomas A. Moulton, W2VY
  4. ; *
  5. ; * This software may only be modified, copied, distributed or
  6. ; * executed for non-profit purposes by individuals operating
  7. ; * systems in the Amateur Radio Service.  Credit to the
  8. ; * author(s) and to the Radio Amateur Telecommunications Society
  9. ; * must be made in modules where RATS provided software is used,
  10. ; * and in any announcements and documentation.  
  11. ; *
  12. ; * As a non-profit, research and development organization,  the
  13. ; * Radio Amateur Telecommunications Society distributes software
  14. ; * in both executable and source forms.  This policy is in place
  15. ; * to encourage the development and distribution of OSI-based,
  16. ; * networking tools.  In order to protect the interests of the
  17. ; * Society and the authors, we have placed some conditions
  18. ; * of use on the software.  Other groups are encouraged
  19. ; * to place the same or similar guidelines on
  20. ; * software they produce.
  21. ; *
  22. ; * The Radio Amateur Telecommunications Society reserves the right
  23. ; * to specify and alter the terms under which software provided by
  24. ; * the Society may be used.  This policy is consistent with the 
  25. ; * objective of uniform and consistent "Open Systems Interconnections."
  26. ; * 
  27. ; * All acceptable Amateur Radio related uses of this software
  28. ; * will be outlined in the "ROSE Implementer's Guide".  Individuals
  29. ; * or organizations wishing to add to, or modify the provisions of
  30. ; * the guide to accommodate local or evolutionary requirements
  31. ; * should document the proposed change(s) and forward them to the
  32. ; * Society.  If accepted, written notification will be provided by
  33. ; * the Society to the submitting organization or individual(s).
  34. ; * The Society will then issue a "ROSE Implementer's Guide Change
  35. ; * Notice".  Periodically, the Society will re-issue the "ROSE 
  36. ; * Implementer's Guide" and incorporate the text of the change 
  37. ; * notices.  This procedure has been put in to place to ensure
  38. ; * compatibility between systems and to ensure their "Openness"
  39. ; * and interoperability.
  40. ; *
  41. ; * No part of this software may be used in other packages 
  42. ; * without prior authorization from the author or the Society.  
  43. ; * Software incorporating this module, all or in part, must be 
  44. ; * provided to the Society prior to distribution or use by
  45. ; * anyone not directly involved in testing of the revised  
  46. ; * environment.  Current releases of the combined software must
  47. ; * be provided to the Society in both source and executable
  48. ; * forms.  Adequate documention to produce an executable module 
  49. ; * from the provided source must also be included.
  50. ; *
  51. ; * Non-Amateur Radio non-profit uses may be authorized on a case
  52. ; * by case basis.  Inquiries for such use may be made in writing
  53. ; * to the Society. Non-commercial uses consistent with the
  54. ; * general principles of Open Systems Interconnection Reference
  55. ; * Model will be generally considered with favor.
  56. ; *
  57. ; * Commercial licensing of the software is also available based
  58. ; * on normal commercial terms.  Licensing inquiries should be
  59. ; * directed to the Society.  Commercial licensing of the standard
  60. ; * software will be done in situations which materially benefit
  61. ; * the Amateur Radio Packet Network.  Additional licensing is
  62. ; * reserved by the individual authors.
  63. ; * 
  64. ; * The Radio Amateur Telecommunications Society provides this software
  65. ; * on an "as is" basis.  The Society assumes no liability for
  66. ; * loss incurred through the use of this software.  Amateur Radio
  67. ; * use of this software implies non-commercial and voluntary 
  68. ; * development, deployment and use of this software in a "Amateur",
  69. ; * non-commercial service.  Commercial users are encouraged to
  70. ; * inspect their copies of the source code.  Source code modification
  71. ; * licenses are available if a combined Object and Source Code
  72. ; * license was not originally established.
  73. ; * 
  74. ; * The Society may be contacted by writing or calling at:
  75. ; * 
  76. ; * The Radio Amateur Telecommunications Society 
  77. ; * 206 North Vivyen Street.
  78. ; * Bergenfield, New Jersey 07621
  79. ; *
  80. ; * Telephone: 201-387-8896
  81. ; *
  82. ; */
  83. ;
  84. ; System Init for ROM
  85. ;
  86.     psect    text,pure
  87.  
  88. *INCLUDE RCONFIG.LIB
  89. *INCLUDE STRUCT.LIB
  90.  
  91. MCTS    EQU    20H
  92. MDCD    EQU    08H
  93. MRTS    EQU    02H
  94.  
  95. POWER_FAIL EQU    0150H
  96.     GLOBAL    CLKBIT, TICKCNT, HDLI
  97.  
  98.     psect    text
  99. start:    di            ;Insure NO int's!!
  100.     jp    POWER_FAIL    ;Power Failure, check memory, etc
  101.     jp    INIT_HDW    ;Set up SDS's based on the machine type
  102.     jp    INIT_LED    ;Init Led's
  103.     jp    UPD_LED        ;Change Led's (toggle)
  104.     HALT            ;Nothing to do when "halted"
  105.     RET
  106.     NOP
  107.  
  108.     global    amul, brelop, wrelop, csv, cret
  109.  
  110. RST2:    jp    (hl)        ;for optimizer    **********'0010'**************
  111.     defm    'PacComm'
  112. RST3:    jp    amul        ;for optimizer    **********'0018'**************
  113.     defm    'DR200'
  114. RST4:    jp    brelop        ;for optimizer    **********'0020'**************
  115.     defb    NUMCH+30h
  116.     defm    'PORT'
  117. RST5:    jp    wrelop        ;for optimizer    **********'0028'**************
  118.     defm    'W2VY'
  119.     defb    0
  120. RST6:    jp    csv        ;for optimizer    **********'0030'**************
  121.     defm    'ROSE'
  122.     defb    0
  123. RST7:    ex    (sp),hl        ;for optimizer    **********'0038'**************
  124.     pop    hl
  125.     jp    cret
  126.  
  127. tickcnt: defb    6        ;Clock is at 300 hz
  128.     defw    0        ;Pointer to Terminal baud rate
  129.     defw    0        ;Pointer to Radio baud rate byte (SCCBI)
  130. ileds:    defb    0        ;Initial LED Pattern
  131.     defw    SDSI0, SDSI1
  132.  
  133.     global    SDS0, SDS1
  134.  
  135. ;  Initialize the SIO data structures
  136.  
  137. INIT_HDW:
  138.     LD    HL,SDSI0    ;Copy from ROM
  139.     LD    DE,SDS0        ;To RAM
  140.     LD    BC,SDSILEN
  141.     LDIR
  142.  
  143.     LD    HL,SDSI1    ;Copy from ROM
  144.     LD    DE,SDS1        ;To RAM
  145.     LD    BC,SDSILEN
  146.     LDIR
  147.  
  148.     COND    NUMCH .gt. 2
  149.     GLOBAL    SDS2
  150.     LD    HL,SDSI2    ;Copy from ROM
  151.     LD    DE,SDS2        ;To RAM
  152.     LD    BC,SDSILEN
  153.     LDIR
  154.     ENDC
  155.  
  156.     COND    NUMCH .gt. 3
  157.     GLOBAL    SDS3
  158.     LD    HL,SDSI3    ;Copy from ROM
  159.     LD    DE,SDS3        ;To RAM
  160.     LD    BC,SDSILEN
  161.     LDIR
  162.     ENDC
  163.  
  164.     LD    A,MCTS        ;DR200 Clock bit (CTS)
  165.     LD    (CLKBIT),A    ;Save it
  166.     LD    A,(tickcnt)
  167.     LD    (TICKCNT),A    ;Number of Interrupts/Tick to 10ms
  168.  
  169.     LD    A,09
  170.     LD    C,8
  171.     OUT    (C),A
  172.     LD    A,0C0H        ;Master Reset for SCC
  173.     OUT    (C),A
  174.     NOP
  175.     NOP            ;Wait for it to happen
  176.  
  177.     COND    NUMCH .gt. 2
  178.     LD    A,09
  179.     LD    C,0ch        ;Daughter Board
  180.     OUT    (C),A
  181.     LD    A,0C0H        ;Master Reset for SCC
  182.     OUT    (C),A
  183.     ENDC
  184.  
  185. ;    Both Radio Port PTT/DCD is always normal
  186.  
  187.     LD    HL,0FF02h    ;PTTMSK1=MRTS, PTTMSK2=FF
  188.     XOR    A
  189.     LD    B,A        ;DCD is Normal - No Toggle
  190.  
  191.     LD    (SDS0+PTTMSK1),HL
  192.     LD    (SDS0+DCDTGL),A
  193.  
  194.     LD    (SDS1+PTTMSK1),HL
  195.     LD    (SDS1+DCDTGL),A
  196.  
  197.     LD    IY,SDS0
  198.     CALL    HDLI
  199.     LD    IY,SDS1
  200.     CALL    HDLI
  201.  
  202.     COND    NUMCH .gt. 2
  203.     LD    IY,SDS2
  204.     CALL    HDLI
  205.     ENDC
  206.  
  207.     COND    NUMCH .gt. 3
  208.     LD    IY,SDS3
  209.     CALL    HDLI
  210.     ENDC
  211.  
  212.     RET
  213.  
  214. INIT_LED:        ;Enter with (_COLD) in A and B
  215.     LD    D,5
  216.     LD    IY,SDS0        ;Get address of port 0
  217.     LD    C,(IY+CPORT)    ; CON Led
  218.     OUT    (C),D        ;WR 5
  219.     AND    80h        ; CON Led is High Bit
  220.     LD    E,A
  221.     LD    A,(IY+WR5REG)    ;Get Current value
  222.     AND    7Fh        ;Ignore DTR
  223.     OR    E        ;Set DTR
  224.     OUT    (C),A
  225.     LD    IY,SDS1        ;Get to SDS1
  226.     LD    C,(IY+CPORT)    ; STA Led
  227.     OUT    (C),D        ;WR 5
  228.     LD    A,B
  229.     AND    40h        ;STA Led is second bit
  230.     SLA    A
  231.     LD    E,A
  232.     LD    A,(IY+WR5REG)
  233.     AND    7Fh        ;Ignore DTR
  234.     OR    E        ;Set DTR
  235.     OUT    (C),A        ;LEDS Now indicate Restart Cause
  236.     RET
  237.  
  238. UPD_LED:
  239.     call    csv
  240.     ld    hl,SDS0            ;Get to SDS0
  241.     call    toggle
  242.     ld    hl,SDS1            ;Get to SDS1
  243.     call    toggle
  244.     jp    cret
  245.  
  246. toggle:
  247.     ld    de,CPORT
  248.     add    hl,de
  249.     ld    c,(hl)        ;Get command port address
  250.     ld    de,WR5REG-CPORT
  251.     add    hl,de
  252.     ld    b,5        ;WR 5
  253.     DI
  254.     ld    a,(hl)
  255.     xor    80h
  256.     ld    (hl),a
  257.     out    (c),b
  258.     out    (c),a
  259.     EI
  260.     ret
  261.  
  262.     GLOBAL    SDSI0, SDSI1
  263. SDSI0:    DEFB    0        ;Channel number
  264.     DEFB    11        ;SCC data port
  265.     DEFB    9        ;SCC control port
  266.     DEFW    DWAIT0
  267.     DEFW    TXDELAY0
  268.     DEFW    SCCBI        ;SYNC CONFIG
  269.     DEFB    SCCAIL        ;LEN
  270.     DEFB    0        ;Flags
  271.     DEFB    0E9h        ;WR5REG (DTR Now On, CON)
  272.  
  273. SDSI1:    DEFB    1        ;Channel number
  274.     DEFB    10        ;SIO data port
  275.     DEFB    8        ;SIO control port
  276.     DEFW    DWAIT1
  277.     DEFW    TXDELAY1
  278.     DEFW    SCCBI        ;8530 Config
  279.     DEFB    SCCBIL        ;LEN
  280.     DEFB    MTIMER        ;Line for timer
  281.     DEFB    069h        ;WR5REG (DTR is Now Off, STA) RTS Off
  282.     ENDC
  283.  
  284.     COND    NUMCH .gt. 2
  285.     GLOBAL    SDSI2
  286. SDSI2:    DEFB    2        ;Channel number
  287.     DEFB    0Fh        ;SIO data port
  288.     DEFB    0Eh        ;SIO control port
  289.     DEFW    DWAIT2
  290.     DEFW    TXDELAY2
  291.     DEFW    SCCCI        ;SYNC CONFIG
  292.     DEFB    SCCCIL        ;LEN
  293.     DEFB    0        ;Flags
  294.     DEFB    0        ;WR5REG
  295.     ENDC
  296.  
  297.     COND    NUMCH .gt. 3
  298.     GLOBAL    SDSI3
  299. SDSI3:    DEFB    3        ;Channel number
  300.     DEFB    0Dh        ;SIO data port
  301.     DEFB    0Ch        ;SIO control port
  302.     DEFW    DWAIT3
  303.     DEFW    TXDELAY3
  304.     DEFW    SCCDI        ;SYNC CONFIG
  305.     DEFB    SCCDIL        ;LEN
  306.     DEFB    0        ;Flags
  307.     DEFB    0        ;WR5REG
  308.     ENDC
  309.  
  310. ;  Fixed data
  311.  
  312. ;  SCC SYNC initialization block.
  313.  
  314. SCCBI:    DEFB    4,0A0H        ;X32, SDLC, Sync
  315.     DEFB    10,0A0H        ;Init CRC, NRZI
  316.     DEFB    7,7EH        ;Sync Definitition (No S!!t)
  317.     DEFB    2,0H        ;Interrupt Vector
  318.     DEFB    3,0DAH        ;8 bit Rx, Enter Hunt, RXCRC, Sync Load Inh.
  319.     DEFB    5,68H        ;8 Bit Tx, Tx Enable
  320.     DEFB    11,68H        ;RXC = DPLL Out, TXC = TRxC, TRxC=IN,
  321.     DEFB    14,0A0H        ;DPLL Source = RTxC (x32 clock)
  322.         DEFB    5,69H        ;8 bit Tx, Tx Enable, TX CRC Enable
  323.     DEFB    3,0DBH        ;Same as 3 above, RX Enable
  324.     DEFB    14,20H        ;Enter Search Mode
  325.     DEFB    15,0E8H        ;Enable Interrupts on 
  326.     DEFB    10H,10H        ;Reset External Interupts, Twice
  327.     DEFB    1,13H        ;Interrupt on Receive and Xmit
  328. SCCAIL    EQU    $-SCCBI
  329.     DEFB    9,9        ;Master Interrupt Enable, Vector Includes Stat
  330. SCCBIL    EQU     $-SCCBI
  331.  
  332.     COND    NUMCH .gt. 2
  333.  
  334. ;DR200A 8530 VALUES FOR INITIALIZAITON
  335.  
  336. ;  SCC ASYNC initialization block.
  337.  
  338. SCCCI:    DEFB    2,10h        ;Set Up Interrupt Vector
  339.     DEFB    14h        ;WR 4 + Reset Ext Intr
  340.     DEFB    84H        ;32xClk + 1Stop + NoParity
  341.     DEFB    11,00H        ;TXC, RXC - RTxC Pin
  342.     DEFB    3        ;WR 3
  343.     DEFB    0C1H        ;8bit + RxEnable
  344.     DEFB    5        ;WR 5
  345.     DEFB    0E8H        ;DTR On + 8bit + TxEnable + RTS Off
  346.     DEFB    11h        ;WR 1 + Reset Ext intr
  347.     DEFB    00011111B     ;Enable rx, ext ints
  348. SCCCIL    EQU    $-SCCCI
  349.  
  350. ;  SCC SYNC initialization block.
  351.  
  352. SCCDI:    DEFB    4,00H        ;X1, SDLC, Sync
  353.     DEFB    10,80H        ;Init CRC, NRZ
  354.     DEFB    7,7EH        ;Sync Definitition (No S!!t)
  355.     DEFB    2,10H        ;Interrupt Vector
  356.     DEFB    3,0DAH        ;8 bit Rx, Enter Hunt, RXCRC, Sync Load Inh.
  357.     DEFB    5,68H        ;8 Bit Tx, Tx Enable
  358.     DEFB    11,08H        ;RXC = RTxC (x1), TXC = TRxC, TRxC=IN,
  359.     DEFB    14,60H        ;Disable DPLL
  360.         DEFB    5,69H        ;8 bit Tx, Tx Enable, TX CRC Enable
  361.     DEFB    3,0DBH        ;Same as 3 above, RX Enable
  362.     DEFB    14,20H        ;Enter Search Mode
  363.     DEFB    15,0E8H        ;Enable Interrupts on 
  364.     DEFB    10H,10H        ;Reset External Interupts, Twice
  365.     DEFB    1,13H        ;Interrupt on Receive and Xmit
  366.     DEFB    9,9        ;Master Interrupt Enable, Vector Includes Stat
  367. SCCDIL    EQU     $-SCCBI
  368.     ENDC
  369.